//package com.openecommerce.service.impl;
//
//import java.util.List;
//
//import javax.annotation.Resource;
//
//import com.openecommerce.constants.CommonConstants;
//import com.openecommerce.constants.OrderConstants;
//import com.openecommerce.domain.Order;
//import com.openecommerce.domain.OrderQueryEntity;
//import com.openecommerce.domain.OrderStatusHistory;
//import com.openecommerce.domain.basic.Page;
//import com.openecommerce.persistence.OrderMapper;
//import com.openecommerce.persistence.OrderStatusHistoryMapper;
//import com.openecommerce.service.OrderService;
//
//public class OrderServiceImpl implements OrderService {
//	
//	@Resource
//	private OrderMapper orderMapper;
//	@Resource
//	private OrderStatusHistoryMapper orderStatusHistoryMapper;
//	
//	public Page<Order> getList(OrderQueryEntity data,int currentPage,int onePageCount){
//		Page<Order> orderPage = new Page<Order>();
//		int countRecord = orderMapper.selectCountByQueryEntity(data);
//		orderPage.setCountRecord(countRecord);
//		orderPage.setCurrentPage(currentPage);
//		orderPage.setOnePageCount(onePageCount);
//		orderPage.calculate();
//		List<Order> list = orderMapper.selectListByQueryEntity(data, orderPage.getStartIndex(), orderPage.getOnePageCount());
//		orderPage.setList(list);
//		return orderPage;
//	}
//
//	public Order get(Long orderId) {
//		return orderMapper.selectByPrimaryKey(orderId);
//	}
//
//	public boolean cancel(Long orderId) {
//		Order record = new Order();
//		record.setOrderId(orderId);
//		record.setStatus(OrderConstants.Status.CANCELED);
//		int result = orderMapper.updateByPrimaryKeySelective(record);
//		return result ==1 ? true:false ;
//	}
//
//	public boolean hold(Long orderId) {
//		Order record = new Order();
//		record.setOrderId(orderId);
//		record.setState(OrderConstants.State.HOLDED);
//		int result = orderMapper.updateByPrimaryKeySelective(record);
//		return result ==1 ? true:false ;
//	}
//
//	public boolean unhold(Long orderId) {
//		Order record = new Order();
//		record.setOrderId(orderId);
//		record.setState(OrderConstants.State.NORMAL);
//		int result = orderMapper.updateByPrimaryKeySelective(record);
//		return result ==1 ? true:false ;
//	}
//
//	public boolean addComment(Long orderId, Short status, String comment,
//			Short customerNoteNotify) {
//		OrderStatusHistory record = new OrderStatusHistory();
//		record.setOrderId(orderId);
//		record.setStatus(status);
//		record.setComment(comment);
//		record.setIsActive(CommonConstants.CommonStatus.ENABLE);
//		record.setIsCustomerNotified(customerNoteNotify);
//		int result = orderStatusHistoryMapper.insertSelective(record);
//		return result ==1 ? true:false ;
//	}
//
//}
